package cn.dengta.webapp.user.entity;

import java.util.Date;

import cn.dengta.common.util.Formats;
import cn.dengta.webapp.base.entity.TimeBasedEntity;
import cn.dengta.webapp.user.model.LoveTreeLevel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.Cmp;

/**
 * 用户爱情树
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("dt_user_love_tree_log")
public class UserLoveTreeLog extends TimeBasedEntity {

	public static final Integer CANCEL_STATUS = -9;
	public static final Integer INIT_STATUS = 0;
	public static final Integer ACCEPT_STATUS = 1;

	/** 邀请者用户id */
	private Long userId;
	/** 被邀请者用户id */
	private Long toUserId;
	/** 比较小的用户id */
	private Long minUserId;
	/** 比较大的用户id */
	private Long maxUserId;
	/** 等级 */
	private LoveTreeLevel level;
	/** 当前等级对应的经验值 */
	private Integer totals;
	/** -9=取消爱情树；1=接受邀请 */
	private Integer status;
	/** 邀请者浇水天数 */
	private Integer userDay;
	/** 被邀请者浇水天数 */
	private Integer toUserDay;
	/** 邀请记录id */
	private Long invitationId;
	/** 接受邀请时间 */
	private Date acceptTime;
	/** 取消时间 */
	private Date cancelTime;

	public static final String USER_ID = "USER_ID";
	public static final String TO_USER_ID = "TO_USER_ID";

	public boolean isInit() {
		return Cmp.eq(this.status, INIT_STATUS);
	}

	public boolean isAccept() {
		return Cmp.eq(this.status, ACCEPT_STATUS);
	}

	public boolean isCancel() {
		return Cmp.eq(this.status, CANCEL_STATUS);
	}

	public String getAcceptTime_() {
		return Formats.formatDefDate(acceptTime);
	}

	public String getCancelTime_() {
		return Formats.formatDefDate(cancelTime);
	}

	public String getAddTime_() {
		return Formats.formatDefDate(addTime);
	}

}
